#ifndef LinkedList_H
#define LinkedList_H

#include <stdio.h>
#include <stdlib.h>
#include "debug.h"

/*
* dynamic linked list
* by No3x - www.no3x.de
* free use but leave this note
* files: LinkedList.h, LinkedList.c
*/

#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif

#ifndef  __cplusplus
typedef enum  bool { FALSE = 0, TRUE } bool;
#endif

typedef struct item {
	struct item *next;
	int id;
	char* msg[50];
} item;

typedef struct List {
	item* head;
} List;


/* creates a new list */
List* List_create(void);
/* adds a element with id to list */
void List_addItem(List* list, int id);
/* frees the entire list */
void List_remove(List* list);
/* adds item with id after the item with id == searchid */
void List_addAfter(List* list, int searchid, int id);
/* deletes the item with id == searchid */
void List_deleteItem(List* list, int searchid);
/* returns the number of items in the list */
int List_countItems(List* list);
/* prints all items of the list, set verbose true for more information */
void List_print(List* list, bool verbose);
/* sorts list by id */
void List_sortById(List* list);
/* returns the list as array */
int* List_getAsArray(List* list);
#endif
